import React, { Component } from 'react'
import axios from 'axios';
export default class App extends Component {
  getStudentsData=()=>{
    axios.get('http://localhost:3000/api1/students')
    .then(
      res=>{
        console.log(res.data)
      },
      err=>{
        console.log(err)
      }
    )
  }
  getCarData=()=>{
    axios.get('http://localhost:3000/api2/car')
    .then(
      res=>{
        console.log(res.data)
      },
      err=>{
        console.log(err)
      }
    )
  }
  render() {
    return (
      <div>
        <button onClick={this.getStudentsData}>获取学生数据</button>
        <button onClick={this.getCarData}>获取汽车数据</button>
      </div>
    )
  }
}
